<script lang="ts">
import { FButton } from 'fok-ui';
import { PropType, defineComponent, h } from 'vue';

export default defineComponent({
  name: 'f-dy-sign',
  props: {
    value: String as PropType<string>
  },
  emits: ['update:value', 'change'],
  setup: (props, { emit }) => {
    const data = ``;
    const notify = () => {
      emit('update:value', data);
      emit('change', data);
    };
    return () =>
      props.value
        ? h('img', { src: props.value, style: 'object-fit:contain', class: 'h80 w80' })
        : h(
            FButton,
            {
              type: 'primary',
              onClick: () => {
                notify();
              }
            },
            () => '签名'
          );
  }
});
</script>
